/* *
 * Copyright 2020 Huawei Technologies Co., Ltd
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include "feature_acl.h"

double getCpuTime()
{
    struct timeval tp;
    gettimeofday(&tp, NULL);
    return double((double)tp.tv_sec * 1.e3 + (double)tp.tv_usec * 1.e-3);
}

double startTime;

void ACL::SetUp()
{
    startTime = getCpuTime();
}
void ACL::TearDown()
{
    double endTime = getCpuTime();
    ACL_LOG("Time elapsed=[%.4lf]s", (endTime - startTime) / 1000.00);
}

void ACL_FUZZ::SetUp()
{
    startTime = getCpuTime();
}
void ACL_FUZZ::TearDown()
{
    double endTime = getCpuTime();
    ACL_CLOG(1, "Time elapsed=[%f]s", (endTime - startTime) / 1000.00);
}

void ACL_PROFILING::SetUp()
{
    startTime = getCpuTime();
}
void ACL_PROFILING::TearDown()
{
    double endTime = getCpuTime();
    ACL_LOG("Time elapsed=[%.4lf]s", (endTime - startTime) / 1000.00);
}
